package com.chixing.Homework;

public class String1 {
    public static void main(String[] args) {
       /* 1. 将指定字符串全部转换成大写
        2. 将指定字符串全部转换成小写
        3. 获得指定字符串的第一个字符
        4. 获得指定字符串的每一个字符
        5. 获得指定字符串的字符长度
        6.将两个字符串拼接成一个字符串
        6. 将指定字符串中的a字母转换成Z
        7. 获得指定字符串中的a字母出现的下标
        9.获得字符串"clone-finalize-getClass-notify-notifyAll-wait" 中的每个单词
        10.将数值76转换成字符串
        11.将数值57.8转换成字符串*/
       String word="Strings are constant their values cannot be changed after they  are created";
       String word1=word.toUpperCase();
       System.out.println("转换成大写" + word1);

       System.out.println("转换成小写" + word1.toLowerCase());

        System.out.println("获得第一个字符" + word.substring(0,1));

        for(int i=0;i<word.length();i++){
            System.out.println("获得每一个字符" + word.charAt(i));
        }

        System.out.println("获得字符长度" + word.length());

        String str="hello world!";
        System.out.println("拼接成一个字符串" + word.concat(str));

        System.out.println("a字母转换成Z" + word.replaceAll("a","Z"));

        System.out.println("a字母出现的下标" + word.indexOf("a"));

        String st="clone-finalize-getClass-notify-notifyAll-wait";
        System.out.print("每个单词" + st.replaceAll("-",","));
        String st1=Integer.toString(76);
        System.out.println(st1);

        String st2=Double.toString(57.8);
        System.out.println(st2);


        String Word="Welcome";

//        String Word1=Word.substring(1,Word.length());
//        String Word2=Word.substring(0,1);
//        String Word3=Word1.concat(Word2);
        String Word1=(Word.substring(1,Word.length()) + Word.substring(0,1));
        System.out.println(Word1);
        for(int i=0;i<Word1.length();i++){
            char num=Word1.charAt(i);
            if((num>'a' && num < 'z') || (num >'A' && num < 'Z') ){
                num+=3;
//                System.out.print("加密之后的输出为 ：");
                System.out.print(num + "");

            }

        }
        System.out.println("\t");
        for(int i=0;i<Word1.length();i++){
            char num=Word1.charAt(i);
            if((num>'a' && num < 'z') || (num >'A' && num < 'Z') ){
                num+=3;
                char num1= (char) (num-3);
                System.out.print(num1);

            }

        }

        String charcode="1Ct3r4ip_ti4C6k9Et^";
        System.out.println("正确的优惠券码: " + charcode.replaceAll("\\d+", ""));




    }
}
